<template>
	<view class="becomeAMerchant">
		<u-form :model="form" ref="uForm">
			<u-form-item>
				<label>店名</label>
				<u-input v-model="form.sName" />
			</u-form-item>
			<u-form-item>
				<label>法定代表人</label>
				<u-input v-model="form.sLegalRepresentaive" />
			</u-form-item>
			<u-form-item>
				<label>身份证</label>
				<u-input v-model="form.sIdentityCard"/>
			</u-form-item>
			<u-form-item>
				<label>联系号码</label>
				<u-input v-model="form.sPhone" />
			</u-form-item>
			<u-form-item>
				<label>地址</label>
				<u-input v-model="form.sAddress" />
			</u-form-item>
		</u-form>
		<view class="label"></view>
		<label>营业执照副本</label>
		<!-- <u-upload class="upload" :action="action" @on-success="onSuccess" :file-list="fileList" :max-count="1"></u-upload> -->
		<u-image v-if="fileList" width="100%" height="400rpx" :src="fileList"></u-image>
		<u-button class="btn" @click="save" type="primary">修改</u-button>
	</view>
</template>

<script>
	export default {
		data() 
		{
			return {
				form:{
					sUid:'',
					sName:'',
					sLegalRepresentaive:'',
					sIdentityCard:'',
					sPhone:'',
					sAddress:'',
					sAvatar:'',
					sAuthority:0
				},
				action:'http://localhost:8881/shop/upload',
				fileList:''
			}
		},
		async onLoad() 
		{
			let res = await this.$u.api.getShopData({id:this.vuex_person.uId})
			this.form = res
			this.fileList = res.sAvatar
			console.log(res);
		},
		methods: {
			async save()
			{
				console.log(1111);
				this.form.sUid = this.vuex_person.uId
				let res = await this.$u.api.getShop(this.form)
				console.log(res);
			},
			onSuccess(data, index, lists, name)
			{
				this.form.sAvatar = data
			}
		}
	}
</script>

<style lang="scss">
	.becomeAMerchant
	{
		padding: 0 40rpx;
		padding-bottom: 50rpx;
		.btn
		{
			display: block;
			margin-top: 50rpx;
		}
		.label
		{
			margin-top: 16px;
		}
		.upload
		{
			// border: 1px solid red;
			margin-top: 16px;
			display: block;
		}
	}
</style>
